import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import nodejs from '@dfeidao/atom-web/msg/nodejs';
import render from '@dfeidao/atom-web/render/render';
import p001 from './p001';


import fire from '@dfeidao/atom-web/msg/fire';
interface Par extends Event {
	page_no: number;
}
export default async function a003(fd: IFeidaoAiBrowserComponent, e: Par) {
	// todo
	const question_bank_type1 = fd.data.node.querySelector<HTMLSelectElement>('[data-id="question_bank_type"]');
	const question_bank_type = question_bank_type1.value;
	const topic_type1 = fd.data.node.querySelector<HTMLSelectElement>('[data-id="topic_type"]');
	const topic_type = topic_type1.value;
	const topic1 = fd.data.node.querySelector<HTMLInputElement>('[data-id="topic"]');
	const topic = topic1.value;

	const fenye = fd.data.node.querySelector<HTMLDivElement>('[data-feidao-presentation="p003"]');

	if (!question_bank_type && !topic_type && !topic) {
		fire('zj-000001', 'a010');
		fenye.style.display = "block";
	} else {
		const res = await nodejs<{res: Array<{}> , s: Array<{}>}>('question-bank/zj-000001/s003', {
			filter: {
				question_bank_type,
				topic_type,
				topic,
				pn: e.page_no
			}
		});
		// data-id="fenye"
		render(fd, res.res, p001, 'p001', 'inner');
		fenye.style.display = "none";
	}







}
